package com.yue.se.event.spring_event;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;

/**
 * 功能描述: TODO <br/>
 * 创建时间: 2016/8/1<br/>
 *
 * @author QiuYang
 */
public class EmailListener implements ApplicationListener {
    @Override
    public void onApplicationEvent(ApplicationEvent event) {
        if (event instanceof EmailEvent){
            EmailEvent emailEvent = (EmailEvent) event;
//            System.out.format("utf-8");
            System.out.println("邮件地址：" + emailEvent.getAddress());
            System.out.println("邮件内容: " + emailEvent.getText());
        }else {
            System.out.println("容器本身事件：" + event);
        }
    }
}
